<?php
namespace app\model\admin;

use think\Db;

class Advert
{
    //获取广告列表
    public function get_advert_lists($where,$sort='',$paginate=10)
    {
        $result_lists = Db::name('advert')->where($where)->order($sort)->paginate($paginate);
        return $result_lists;
    }

    //广告详情
    public function advert_detail($advert_id){
        $result = Db::name('advert')->where('id',$advert_id)->find();
        return $result;
    }

    //广告添加
    public function add_advert($data){
        $status = Db::name('advert')->insert($data);
        return $status;
    }

    //广告修改
    public function update_advert($where,$data){
        $status = Db::name('advert')->where($where)->update($data);
        return $status;
    }

    //广告删除
    public function delete_advert($array_id){
        $advert_delete = Db::name('advert')->delete($array_id);
        return $advert_delete;
    }

}


